package com.boodaba.todocarts.test.domain;


import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import com.boodaba.todocarts.domain.Label;
import com.boodaba.todocarts.domain.LabelIdSpecification;

public class LabelIdSpecificationShould {
	private LabelIdSpecification SUT;
	private final String mTargetTitle = "some usefull label";
	
	
	@Before
	public void setUp() throws Exception {
		SUT = new LabelIdSpecification(mTargetTitle);
	}

	@Test
	public void satisfiedByLabelsWithExactTitle() {
		assertTrue(SUT.isSatisfiedBy(new Label(mTargetTitle)));
		assertFalse(SUT.isSatisfiedBy(new Label("other title")));
		assertFalse(SUT.isSatisfiedBy(new Label(mTargetTitle.substring(0, 7))));
		assertFalse(SUT.isSatisfiedBy(new Label(mTargetTitle + " actually")));
	}
	
	@Test
	public void satisfiedByLabelsCaseSens() {
		assertFalse(SUT.isSatisfiedBy(new Label(mTargetTitle.toUpperCase())));
	}
	
	@Test
	public void operateWithNullToCheck() {
		assertFalse(SUT.isSatisfiedBy(null));
	}
}
